home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Internet 2001 September / MICD2001_09_NR2.iso / Flash / Przyklady / Sterowanie.swf / scripts / frame_1 / PlaceObject2_2_1 / CLIPACTIONRECORD onClipEvent(enterFrame).as next >
Text File  |  2001-07-23  |  1KB  |  44 lines

  1. onClipEvent(enterFrame){
  2.    if(Key.isDown(Key.UP))
  3.    {
  4.       if(predkosc < Maksymalna_w_przod)
  5.       {
  6.          predkosc += przyspieszenie;
  7.       }
  8.    }
  9.    if(Key.isDown(Key.DOWN))
  10.    {
  11.       if(Maksymalna_w_tyl < predkosc)
  12.       {
  13.          predkosc -= przyspieszenie;
  14.       }
  15.    }
  16.    if(granica_obrotu < Math.abs(predkosc))
  17.    {
  18.       if(Key.isDown(Key.RIGHT))
  19.       {
  20.          kierunek -= Kat_obrotu;
  21.          this._rotation = - kierunek;
  22.       }
  23.       else if(Key.isDown(Key.LEFT))
  24.       {
  25.          kierunek += Kat_obrotu;
  26.          this._rotation = - kierunek;
  27.       }
  28.    }
  29.    this._y -= predkosc * Math.cos(3.141592653589793 * kierunek / 180);
  30.    this._x -= predkosc * Math.sin(3.141592653589793 * kierunek / 180);
  31.    if(this._x < ObszarXMIN || ObszarXMAX < this._x || this._y < ObszarYMIN || ObszarYMAX < this._y)
  32.    {
  33.       predkosc = - predkosc * strata_energii;
  34.    }
  35.    if(0 < predkosc)
  36.    {
  37.       predkosc -= opor_ruchu;
  38.    }
  39.    if(predkosc < 0)
  40.    {
  41.       predkosc += opor_ruchu;
  42.    }
  43. }
  44.